<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="cn.edu.nju.ws.sview.Config,cn.edu.nju.ws.sview.views.Group,java.util.Enumeration,java.util.HashSet,java.util.ArrayList,cn.edu.nju.ws.sview.views.User" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SView 账号设置</title>
<link rel="icon" href="favicon.ico" />

<link rel="stylesheet" type="text/css" href="/sview/css/layout.css" />
<link rel="stylesheet" type="text/css" href="/sview/css/lang_set.css" />
<link rel="stylesheet" type="text/css" href="/sview/css/account.css" />
<link rel="stylesheet" type="text/css" href="/sview/css/easyui.css" />
<script type="text/javascript" src="/sview/script/jquery.js"></script>
<script type="text/javascript" src="/sview/script/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/sview/script/global.js"></script>
<script type="text/javascript" src="/sview/script/account.js"></script>
</head>
<body>
<%
	String lang = request.getParameter("lang");
	if(lang!=null &&lang.equals("en")){
		request.getRequestDispatcher("account.jsp").forward(request,response);
		 return;
	}else if(lang==null){
		lang="zh" ;
	} 
	
	String user =(String)session.getAttribute("user");
	if(user==null){
		String location = "/sview/views/index.jsp";
		if(lang.equals("zh"))
			location = location+"?lang="+lang;
		response.sendRedirect(location);
		return;
	}
%>
<jsp:include page="/vheader_zh.jsp" flush="true">
   <jsp:param name="f" value="e"/>
</jsp:include>
<div class="container">
   <div class="top">
      <div class="mspacing"></div>
     <div class="operation">账号设置</div>
     <div class="mspacing"></div>
   </div>
   <div class="mspacingLittle"></div>
   <div class="main">
	<div class="leftPanel">
	 <ol class='leftnav'>
        <li><a class="nav-item pflang" href="javascript:void(0)" onclick="return false">偏好语言</a></li>
        <li><a class="nav-item mgroup" href="/sview/group/gmanage.jsp?lang=zh">我的编辑组</a></li>
     </ol>
	</div>
	<div class="rightPanel">
	  <div class="lang-display-set">
	     <div class="hint">你喜欢用哪些语言来查看 SView 内容？</div>
	     <div> 
        		        <%
	           HashSet<String> preferLangs  = (new User(user)).getPreferedLanguages();
	        %>
	        <%if(preferLangs.contains("en")){ %>
        	<span><input type="checkbox" value="en" name="prefer-langs" checked />英语</span>
        	<%}else{ %>
        	<span><input type="checkbox" value="en" name="prefer-langs" />英语</span>
        	<%} if(preferLangs.contains("zh")){%>
        	<span><input type="checkbox" value="zh" name="prefer-langs" checked />中文（简体）</span>
        	<%}else{ %>
        		<span><input type="checkbox" value="zh" name="prefer-langs"/>中文（简体）</span>
        	<%} %>
         </div>
         <div class="mspacingLittle dis"></div>
	     <div class="form-button">
	       <div id ="preferLangbuttons" class="formbuttons">
	        <input type="button" value="保存" class="sbutton btn btn-primary fb">
	       </div>
	     </div>
	  </div>

	</div>
	</div>
</div>
<input type="hidden" id="display-lang" name="display-lang" value="zh"/>
<jsp:include page="/vfooter_zh.jsp"></jsp:include>
</body>
</html>